package run.siyuan.rabbitmq.demo.controller;


import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import run.siyuan.rabbitmq.demo.producer.ProducerService;

@ResponseBody
@RestController
public class RabbitmqController {

    @Autowired
    private ProducerService producerService;

    @GetMapping("sendMsg")
    private JSONObject sendMsg(@RequestBody JSONObject json) {
        producerService.sendMsg(json);
        return JSONUtil.createObj().append("message", "success");
    }

}
